package com.michaelbulava.TFS.vcs.internal;

import com.intellij.openapi.vcs.FilePath;
import com.intellij.util.containers.DistinctRootsCollection;

import java.util.Collection;

/**
 * Created by mbulava on 6/9/2015.
 */
public abstract class RootsCollection {

    public static class FilePathRootsCollection extends DistinctRootsCollection<FilePath>{

        public FilePathRootsCollection(Collection items){
            super(items);
        }

        public FilePathRootsCollection(){
            super();
        }

        @Override
        protected boolean isAncestor(FilePath parent, FilePath child) {
            if (parent == null)
                throw new IllegalArgumentException("parent cannot be null");
            if (child == null)
                throw new IllegalArgumentException("child cannot be null");

            return child.isUnder(parent, false);
        }
    }
}
